<template>
  <div class="page">
    <!-- search -->
    <div
      class=""
      style="display: flex;flex-direction: row;align-items: center;padding: 12px;background-color: #FFFFFF;justify-content: space-between;"
    >
      <div
        class=""
        @click="popBack()"
      >
        <i
          class="iconfont icon-arrow-left"
          style="font-size: 16px;font-weight: bold;"
        ></i>
        <span style="font-size: 16px;">{{baseInfo.chnName}}</span>
      </div>
      <div style="
				display: flex;align-items: center; background-color: #55aa0030;
				padding: 5px 12px;border-style: solid;border-width: 1px;border-color: #55aa00;max-width: 90px;">
        <div style="text-align: center;font-size: 14px;color: #55aa00;display: block;">合作中</div>
      </div>
    </div>



    <!-- list -->
    <div
      class=""
      style="flex: 1;overflow-y: auto;"
    >
      <!-- 基本信息 -->
      <div style="padding: 12px;background-color: #FFFFFF">
        <form-title :title="baseInfo.title"></form-title>
        <form-key-value-row
          :keystr="key"
          :valuestr="baseInfo.data[key]"
          :tagstr="idx==0?'校园大使':undefined"
          v-for="(key,idx) in Object.keys(baseInfo.data)"
          :key="idx"
        ></form-key-value-row>
      </div>

    </div>

  </div>
</template>

<script>
import { marketRead } from "../../api/workbench.js";
// import FormTitle from "@/components/form-title/form-title";
// import FormKeyValueRow from "@/components/form-key-value-row/form-key-value-row";
export default {
  components: {
    "form-title":()=>import("@/components/form-title/form-title"),
    "form-key-value-row":()=>import("@/components/form-key-value-row/form-key-value-row")
  },
  data() {
    return {
      marketId: "",
      baseInfo: {
        style: "00",
        title: "基础资料",
        chnName: "szw",
        data: {
          渠道类型: "校园大使",
          负责人: "张三",
          电话: "13066666666",
          跟进进度: "1111",
          对接老师: "张学友",
          创建人: "333",
          创建时间: "2021年9月26日",
        },
      },
    };
  },
  created() {
    let { id } = this.$route.query;
    this.marketId = id;
  },
  mounted() {
    this.netMarketRead();
  },
  methods: {
    popBack() {
      this.$router.back({});
    },
    netMarketRead() {
      let self = this;
      let fi = {
        id: this.marketId,
      };
      marketRead(fi)
        .then((res) => {
          let { data } = res;
          console.error(JSON.stringify(res));
          self.baseInfo.chnName = data.chnName;
          self.baseInfo.data = {
            渠道类型: data.chnType,
            负责人: data.chnHead,
            电话: data.phone,
            跟进进度: "szw",
            对接老师: data.dockPeople,
            创建人: data.createBy,
            创建时间: data.createTime,
          };
        })
        .catch((e) => {});
    },
  },
};
</script>

<style scoped>
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #f4f5f7;
}
</style>
